package com.mineoj.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mineoj.model.dto.solution.SolutionAddRequest;
import com.mineoj.model.dto.solution.SolutionQueryRequest;
import com.mineoj.model.entity.Solution;
import com.mineoj.model.entity.User;
import com.mineoj.model.vo.SolutionVO;
import com.baomidou.mybatisplus.extension.service.IService;

import javax.servlet.http.HttpServletRequest;

/**
* @author 明月
* @description 针对表【solution(题解)】的数据库操作Service
* @createDate 2025-04-05 16:15:29
*/
public interface SolutionService extends IService<Solution> {
    /**
     * 校验
     *
     * @param solution
     * @param add
     */
    void validSolution(Solution solution, boolean add);

    /**
     * 创建题解
     * @param solutionAddRequest
     * @param loginUser
     * @return
     */
    long doSolution(SolutionAddRequest solutionAddRequest, User loginUser);

    /**
     * 获取查询条件
     *
     * @param solutionQueryRequest
     * @return
     */
    QueryWrapper<Solution> getQueryWrapper(SolutionQueryRequest solutionQueryRequest);
    

    /**
     * 获取帖子封装
     *
     * @param solution
     * @param request
     * @return
     */
    SolutionVO getSolutionVO(Solution solution, HttpServletRequest request);

    /**
     * 分页获取帖子封装
     *
     * @param solutionPage
     * @param request
     * @return
     */
    Page<SolutionVO> getSolutionVOPage(Page<Solution> solutionPage, HttpServletRequest request);

    /**
     * 删除题解
     * @param id
     * @return
     */
    boolean deleteById(long id);
}
